package be.kuleuven.cs.mume.gestures;

import org.mt4j.input.inputProcessors.IGestureEventListener;
import org.mt4j.input.inputProcessors.MTGestureEvent;
import org.mt4j.input.inputProcessors.componentProcessors.tapProcessor.TapEvent;

import be.kuleuven.cs.mume.WorldController;
import be.kuleuven.cs.mume.objects.PhysicsRoundedRectangle;

public class MyListener implements IGestureEventListener {

	@Override
	public boolean processGestureEvent(MTGestureEvent ge) {

		TapEvent te = (TapEvent) ge;
		PhysicsRoundedRectangle r  = (PhysicsRoundedRectangle)ge.getTargetComponent();
		if (te.getId() == MTGestureEvent.GESTURE_ENDED && te.isTapped() && (!r.isRemoved() && !r.isReset()) ) {
			WorldController.getSingleton().objectClicked(
					ge.getTargetComponent());
		}
		return false;
	}

}
